package cn.pconline.autoclub.entity;

import java.util.Date;

import org.gelivable.dao.Column;
import org.gelivable.dao.Entity;
import org.gelivable.dao.Id;
/**
 * 
 * @author fengguosen
 */
@Entity(tableName = "ac_invite_join")
public class InviteJoin {
	
	@Id
	@Column(name="invite_id")
	private long inviteId;
	@Column(name="club_id")
	private long clubId;
	@Column(name="invite_code")
	private String inviteCode; //邀请url code
	@Column(name="invited_count")
	private int invitedCount;	//已邀请了多少人
	@Column(name="create_at")
	private Date createAt;		//邀请创建时间
	@Column(name="create_by")
	private long createBy;		//创建者==邀请者
	@Column(name="overdue_at")
	private Date overdueAt;		//邀请过期时间
	/**未过期 */
	public static final int STATUS_ON =0;	
	/**已过期 */
	public static final int STATUS_OF = -1; 
	/**一键推荐可以加入多少个成员 */
	public static final int INVITE_JOIN_COUNT = 100;
	/**一键推荐有效天数 */
	public static final int INVITE_VALID_DAY = 10;
	public long getInviteId() {
    	return inviteId;
    }
	public void setInviteId( long inviteId ) {
    	this.inviteId = inviteId;
    }
	public long getClubId() {
    	return clubId;
    }
	public void setClubId( long clubId ) {
    	this.clubId = clubId;
    }
	public String getInviteCode() {
    	return inviteCode;
    }
	public void setInviteCode( String inviteCode ) {
    	this.inviteCode = inviteCode;
    }
	public int getInvitedCount() {
    	return invitedCount;
    }
	public void setInvitedCount( int invitedCount ) {
    	this.invitedCount = invitedCount;
    }
	public Date getCreateAt() {
    	return createAt;
    }
	public void setCreateAt( Date createAt ) {
    	this.createAt = createAt;
    }
	public long getCreateBy() {
    	return createBy;
    }
	public void setCreateBy( long createBy ) {
    	this.createBy = createBy;
    }
	public Date getOverdueAt() {
    	return overdueAt;
    }
	public void setOverdueAt( Date overdueAt ) {
    	this.overdueAt = overdueAt;
    }
	public boolean isOverdue(){
            if(overdueAt==null){
                return true;
            }
            return invitedCount>=InviteJoin.INVITE_JOIN_COUNT || !overdueAt.after(new Date());
        }
}
